
class Goods(object):

    def __init__(self, good_price, discount):
        self.good_price = good_price
        self.discount = discount

    @property
    def price(self):
        return self.good_price

    @price.setter
    def price(self, new_price):
        if new_price > 0:
            self.good_price = new_price

    @price.deleter
    def price(self):
        print("执行了删除方法")


if __name__ == '__main__':
    g = Goods(1000,0.8)
    print(g.price)
    g.price = 500
    g.price
    print(g.price)
    del g.price
